<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .ul {
            display: flex;
            align-items:center;
            height:300px;
            justify-content:center;
        }

        .ul li {
           flex: 1;background: #ccc;
           box-sizing: border-box;
           border: 1px solid #000;
           height: 50px;
           justify-content:center;
        }
        .box{
	    display: flex;
	    width:980px;
	    height:30rem;
	    align-items:center;
	    background:#0099cc;
        justify-content:center;
	    }
    </style>
</head>

<body>
    <ul class="ul">
        <li>111</li>
        <li>222</li>
        <li>333</li>
    </ul>
    <ul class="ul">
        <li>111</li>
        <li>222</li>
        <li>333</li>
        <li>444</li>
        <li>555</li>
    </ul>

    <div class="box">
       <h1>flex弹性布局justify-content属性实现元素水平居中</h1>
    </div>
</body>

</html>